package practice;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * 找座位
 */
public class SearchSeat {

    public static void main(String[] args) {
        while (true) {
            Scanner sc = new Scanner(System.in);
            List<Integer> list = Arrays.stream(sc.nextLine()
                            .split(" "))
                    .map(Integer::parseInt)
                    .collect(Collectors.toList());

            if (list.size() < 3) {
                System.out.println(1);
            }
            int count = 0;
            for (int i = 1; i < list.size() ; i++) {
                Integer e = list.get(i);
                if (e == 1) {
                    // 位置被占直接跳过
                    continue;
                }
                // 当前位置及前后一个都空着
                if (list.get(i-1) == 0 && list.get(i+1) == 0 && e == 0) {
                    count++;
                    list.set(i,1);
                }
            }
            // 处理最后一个
            if (list.get(list.size()-2) == 0 && list.get(list.size()-1) == 0) {
                count++;
            }
            System.out.println(count);
        }
    }
}
